geos
Rust bindings for GEOS C API.
The supported geos version is >= 3.5
Disclaimer
GEOS can be a tad strict on the validity on the input geometry and is prone to crash on invalid input, so they need to be checked in the wrapper. This project is checked with valgrind, but if you stumble on a crash feel free to open an issue explaining the problem.
Usage example
You can check the examples in the examples/
directory.
Constructing geometries from WKT:
extern crate geos;
let gg1 = new_from_wkt.expect;
let gg2 = new_from_wkt.expect;
let gg3 = gg1.difference.expect;
assert_eq!;
"Preparing" the geometries for faster predicates (intersects, contains, etc.) computation on repetitive calls:
extern crate geos;
let g1 = new_from_wkt.expect;
let g2 = new_from_wkt.expect;
let pg1 = new.expect;
let result = pg1.intersects.expect;
assert_eq!;
Conversion from rust-geo
rust-geo's objects can be converted into GEOS to use all geos algorithms.
Complete example can be found in examples/from_geo.rs
extern crate geos;
extern crate geo_types;
use TryInto;
use ;
// first we create a Geo object
let exterior = LineString;
let interiors = vec!;
let p = new;
// and we can create a Geos geometry from this object
let geom: Geometry = .try_into.expect;
// do some stuff with geom
Voronoi
Voronoi diagrams computation are available in the bindings.
For those to be easier to use with rust-geo some helpers are available in voronoi.rs
.
extern crate geo_types;
use Point;
let points = vec!;
let voronoi = compute_voronoi.expect;
Contributing
Only a subset of geos has been implemented, feel free to add wrappers for missing features.
All added features needs to be tested and this being a C wrapper, valgrind runs on all examples/tests to check that no bugs / memory leaks are lurking.